<template>
	<view class="content">
		
		<view class="rate-box">
			<view class="item" v-for="(item, index) in rateList" :key="index">
				<view class="name">
					
					<view class="left">{{  item.userNickName }}</view>
					<view class="time">{{ item.commentDate || ''}}</view>
				</view>
				<view class="content">{{ item.comment }}</view>
				<view class="img-box">
					<view class="my-img" v-if="item.commentImage && item.commentImage !== ''">
						<img :src="itemss" alt="" v-for="(itemss, indexs) in item.commentImage.split(',')" 
						:key="indexs" class="my-img" @click="previewImage(item.commentImage.split(',')[indexs])"   style="width: 106rpx;height: 106rpx;position: relative; top: 0rpx; "  >
					</view>
					<view class="my-img" v-if="item.commentVideo && item.commentVideo !== '' ">
						<video :src="item"  mode=""  objectFit="cover"
								style="width: 106rpx;height: 106rpx;position: relative; top: 0rpx; " v-for="(item, index) in item.commentVideo.split(',')" 
								:key="index"  :show-play-btn="false" :show-fullscreen-btn="false"></video>
					</view>
				</view>
				<view class="rate-bbox">
					<u-rate active-color="#FFD100" size="32" :current="item.rating" :disabled="true">
					</u-rate>
				</view>
				
			</view>
		</view>
		<view class="loadmore">
			<u-loadmore :status="status" />
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
	
				status: 'loadmore', // this.status = 'nomore'  设置底部加载更多显示
				navActive: 1,
				
				
				rateList: []
			}
		},
		onLoad(params) {
			this.getData(params)
		},
		methods: {
			// 图片预览
			previewImage(image, image1) {
				console.log(image,image1, '预览图片中')
				 uni.previewImage({
					current: 0,     // 当前显示图片的链接/索引值
					urls: [image],    // 需要预览的图片链接列表，photoList要求必须是数组
					loop:true   // 是否可循环预览
				});
			},
			getData(params) {
				this.status ='loading'
				this.$http({
					url: this.$myApi.seeAppraiseList + '?scenicSpotsId=' + params.number,
					method: 'GET',
					hideLoading: true,
					// data: data,
					success: res => {
						if (res.code == 200) {
							this.rateList = res.rows;
							// console.log(this.rateList, '评价列表')
						} else {
							uni.showToast({
								title: res.msg,
								duration: 2000,
								icon: 'none'
							});
						}
						this.status ='nomore'
					},
					fail: err => {
						uni.showToast({
							title: err.msg,
							duration: 2000,
							icon: 'none'
						});
					},
					complete: e => {
						this.status ='nomore'
						uni.stopPullDownRefresh();
					}
				})
			}
		} 
	}
</script>

<style lang="scss">
	.rate-box {
		width: 690rpx;
		
		border-radius: 10rpx;
		opacity: 1;
		margin-left: 30rpx;
		// margin-top: 10rpx;
		padding-bottom: 24rpx;
		.item {
			
			margin-bottom: 20rpx;
			position: relative;
			background: #FFFFFF;
			border-radius: 10rpx;
			padding: 22rpx 29rpx 2rpx 26rpx;
			.rate-bbox {
				width: 100%;
				margin-bottom: 14rpx;
				text-align: right;
			}
			.time {
				font-size: 28rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				color: #4C4C4C;
				// width: 100%;
				text-align: right;
				margin-top: 4rpx;
			}
			.img-box {
				display: flex;
				flex-direction: row;
				flex-wrap: wrap;
				margin-top: 10rpx;
				// margin-bottom: 20rpx;
				.my-img {
					width: 160rpx;
					height: 110rpx;
					border-radius: 10rpx;
					// border: 1rpx solid #ccc;
					margin-right: 12rpx;
				}
			}
			.content {
				margin-top: 10rpx;
				line-height: 36rpx;
				// height: 90rpx !important;
				// margin-top: -8rpx;
				// display: -webkit-box;  
				//   -webkit-line-clamp: 3 !important; /* 控制显示行数 */  
				//   -webkit-box-orient: vertical;  
				//   overflow: hidden;  
				//   text-overflow: ellipsis;  
				//   word-wrap: break-word; /* 防止内容被强制折行 */  
			}
			.name {
				display: flex;
				flex-direction: row;
				justify-content: space-between;
				font-size: 30rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: bold;
				color: #1C1C1C;
				height: 42rpx;
				line-height: 42rpx;
			}
			
		}
		
	}
	
	
	
</style>

<style>
	page {
		background: #EFEFEF;
		padding-bottom: 30rpx;
	}
</style>